#ifndef ENTITY_H
#define ENTITY_H

class Mesh;

#include "Image.h"
#include "Troll3D_global.h"

#include "Mesh/Mesh.h"
#include "UniformMat4.h"

#include <Transform.h>
#include <Program.h>

#include <string>
#include <vector>

using namespace std;

/*! @brief The Entity class is the "main" class of Troll 3D. All object inside the scene will derive from Entity        */
class TROLL3DSHARED_EXPORT Entity
{
    /********************************
    /*          Public
    /********************************/
    public :

        /********************************
        /*          Constructors
        /********************************/

            Entity();

        /********************************
        /*          Methods
        /********************************/

            void Append(Entity &entity);
            void Prepend(const Entity & entity);

        /********************************
        /*          Properties
        /********************************/

            string              m_Name;
            vector<Entity*>     m_Childs;

            Image   *           m_image;
            Material*           m_Material;
            Mesh *              m_Mesh;
            Transform    *      m_Transform;

            vector<Uniform *> m_Uniforms;

            void    BindAttribute();

        /********************************
        /*          Virtual
        /********************************/

            virtual void Update();
            virtual void Display();

        /********************************
        /*          Static Properties
        /********************************/

            static std::vector<Entity *> Entities;

            static Entity & First();
            static Entity & Last();


        /********************************
        /*          Static Method
        /********************************/

            static Entity * FindEntity(std::string name);

            static void Remove(Entity * entity);
            static void Remove(int id);

    /********************************
    /*          Private
    /********************************/
    private :

        /********************************
        /*          Methods
        /********************************/

            void    SendUniforms();


};

#endif
